@import './_constant.less';

.editor-main {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 46px;
  box-sizing: border-box;

  header {
    height: 56px;
  }
}

.pix-pro-container {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 960px;
  background-color: #fff;
  border-radius: @radius;
  overflow: hidden;
  position: relative;

  .close-btn {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 10px;
    left: 10px;
    cursor: pointer;
    border: none;
    background: none;
  }
  
  // 侧边栏
  nav {
    width: 160px;
    min-width: 140px;
    max-width: 200px;
    box-sizing: border-box;
    border-right: 1px solid @border-color;
    padding: 56px 10px 0;
    position: relative;

    menu {
      padding: 0;
      margin: 0;
    }
    menu > div {
      padding: 12px 16px;
      display: flex;
      align-items: center;
      cursor: pointer;
      border-radius: @radius;
      margin: 5px 0;
      .ani300();
      
      &:hover {
        background-color: @selected-bgc;
      }

      i {
        margin-right: 5px;
      }

      span {
        font-size: 14px;
        display: inline-block;
        margin-left: 5px;
      }

      &.active {
        background-color: @selected-bgc;
      }
    }

    menu.disabled > div {
      opacity: 0.5;
      pointer-events: none;
    }

    figure.logo {
      margin: 0;
      padding: 0;
      position: absolute;
      bottom: 20px;
      left: 25px;
    }
  }

  // 操作区
  .controls-container {
    width: 268px;
    min-width: 268px;
    max-width: 300px;
    box-sizing: border-box;
    background-color: #fff;
    border-right: 1px solid @border-color;
    display: flex;
    flex-direction: column;
    padding: 64px 20px 0;

    .control-header {
      margin-bottom: 10px;
      h3 {
        margin: 0 0 0 0;
        font-size: 24px;
        color: #333;
        font-weight: 500;
      }
      small {
        color: #9198A9;
        margin-top: 10px;
        display: block;
      }
    }
  }

  .crop {
    div.section {
      margin-bottom: 15px;
    }
    .size-inputs {
      display: flex;
      align-items: center;
      justify-content: space-between;

      label {
        display: inline-block;
        font-size: 14px;
        margin-bottom: 8px;
      }
      input {
        width: 100px;
        height: 30px;
        border: 1px solid #e8e8e8;
        border-radius: @radius;
        padding: 0 10px;
        box-sizing: border-box;
      }
    }
    .flip-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
      button {
        width: 30px;
        height: 30px;
        border-radius: @radius;
        border: none;
        background: none;
        cursor: pointer;
        .ani300();

        &:hover {
          background-color: #f5f5f5;
        }

        &:not(:last-child) {
          .btn-line();
          &:before {
            right: -20px;
          }
        }
      }
    }
  }

  .remove-bg {
    .color-list {
      small {
        display: block;
        margin-bottom: 20px;
      }
    }
    .color-box {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 5px;
      
      .color-item {
        width: 50px;
        height: 50px;
        border-radius: 6px;
        cursor: pointer;
        overflow: hidden;
        border: 2px solid transparent;
        padding: 3px;
        box-sizing: border-box;

        span {
          display: block;
          box-sizing: border-box;
          border: 1px solid #CDD5DD;
          width: 100%;
          height: 100%;
          border-radius: 6px;
          overflow: hidden;
        }

        &.transparent span {
          display: flex;
          align-items: center;
          justify-content: center;
          &::before {
            content: '';
            width: 60px;
            height: 1px;
            background-color: red;
            transform: scale(1.3) rotate(-45deg);
          }
        }

        &.active {
          border-color: @primary-color;
        }
      }
    }
  }

  .image-container {
    flex: 1;
    min-width: 400px;
    background-color: #fafafa;
    display: flex;
    flex-direction: column;

    .reset-actions, .step-actions {
      .btn-line();
    }

    .image-toolbar {
      height: 56px;
      padding: 0 16px 0 30px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background-color: #efefef;
      border-bottom: 1px solid #e8e8e8;

      .toolbar-status {
        color: #184AFF;
        font-size: 14px;
      }

      .toolbar-box {
        height: 100%;
        min-width: 480px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        > div {
          padding: 0 10px;
        }
      }
    }

    .image-content {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #f9f9f9;
      box-sizing: border-box;
      position: relative;

      .image-box {
        flex: 1;
        height: 100%;
        position: relative;

        .image-loading {
          box-sizing: border-box;
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          background-color: rgba(255, 255, 255, 0.7);
          z-index: 9;
          font-size: 24px;
          .ani300();

          &.hide {
            opacity: 0;
            pointer-events: none;
          }
        }

        .main-loading {
          position: absolute;
          width: auto;
          height: auto;
          padding: 12px 18px;
          display: flex;
          flex-direction: row;
          align-items: center;
          justify-content: center;
          bottom: 60px;
          left: 50%;
          transform: translateX(-50%);
          z-index: 15;
          background-color: rgba(30, 30, 30, 0.85);
          border-radius: 6px;
          box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
          backdrop-filter: blur(3px);
          transition: opacity 0.3s ease;
          
          .progress-bar {
            position: relative;
            width: 180px;
            height: 4px;
            background-color: rgba(255, 255, 255, 0.15);
            border-radius: 2px;
            overflow: hidden;
            margin-right: 12px;
            
            .progress-fill {
              height: 100%;
              width: 100%;
              background-color: #ffffff;
              border-radius: 2px;
              transform-origin: left center;
              transform: scaleX(0);
              transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
              position: relative;
            }
          }
          
          .progress-percentage {
            color: #ffffff;
            font-size: 13px;
            min-width: 36px;
            text-align: right;
            font-weight: 500;
            font-family: 'Arial', sans-serif;
          }
        }
      }
      .image-rotate-box {
        box-sizing: border-box;
        padding: 10px;
        width: 100px;
      }
    }
  }

  
  .toolbar-btn {
    padding: 8px 20px;
    border: none;
    border-radius: @radius;
    cursor: pointer;
    margin: 0 5px;
    .ani300();

    &:hover {
      background-color: #fff;
    }

    &.primary {
      background-color: @primary-color;
      border-color: @primary-color;
      color: #fff;

      &:hover {
        background-color: #40a9ff;
      }
    }
    &.primary-text {
      color: @primary-color;
    }
    &.flip {
      transform: scaleX(-1);
    }
    &.disabled {
      opacity: 0.5;
      pointer-events: none;
    }
  }

  .icon-btn {
    padding: 8px;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    border-radius: @radius;
    margin: 5px 0;
    .ani300();

    &:hover {
      background-color: #f5f5f5;
    }

    i {
      width: 30px;
      height: 20px;
    }

    span {
      display: inline-block;
      margin-left: 10px;
      font-size: 14px;
    }

    &.active {
      background-color: #f5f5f5;
    }

    &.disabled {
      opacity: 0.5;
      pointer-events: none;
    }
  }
}
.disabled {
  opacity: 0.5;
  pointer-events: all;
  cursor: not-allowed;
  & > * {
    pointer-events: none;
  }
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
span.line {
  display: block;
  width: 100%;
  height: 1px;
  background-color: #e8e8e8;
  margin: 20px 0;
}

.full-screen-blocker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 21; // 确保高于其他所有元素
  background-color: transparent; // 完全透明
  cursor: wait; // 显示等待光标
  user-select: none; // 防止文本选择
  pointer-events: all; // 捕获所有点击事件
}